package day13;

import org.junit.Before;
import org.junit.Test;

import java.util.ArrayList;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ArraysList {
    List<String> list=new ArrayList();
    @Before
    public void before(){
        list.add("abc");
        list.add("123");
        list.add("java");
        list.add("mysql");
        list.add("别跑啊");
        System.out.println("排序前："+list);
        //asList是数组工具类Arrays提供的静态方法
        //用于将数组转换为‘不可变的集合’，无法新增和删除
        List<String> list2= Arrays.asList("abd","123","java","mysql","你好啊");
        System.out.println(list2);
    }
    @Test
    public void test(){
        for (int i=0;i<list.size();i++){
            String s= list.get(i);
            if (s.length()<4){
                list.set(i,("0"+s));
            }
        }
        System.out.println("排序后："+list);
    }
}
